package com.leesche.zcsp.node.app.v1.controller.admin;

import com.leesche.zcsp.node.web.service.privilege.PrivilegeService;
import com.leesche.zcsp.node.web.vo.Principal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by kaider on 2016/11/26.
 */
public class AppAdminController {
    private final static Logger LOGGER = LoggerFactory.getLogger(AppAdminController.class);

    @Autowired
    private PrivilegeService privilegeService;

    public Long getAdminId(){
        Principal principal = privilegeService.getCurrentPrincipalForApp();
        Long adminId;
       if(principal.getParentid()==1||principal.getNtype()==4){
            adminId = principal.getUserid();
        }else{
            adminId = principal.getParentid();
        }
        return adminId;
    }

    public String getBusinessNo(){
        Principal principal = privilegeService.getCurrentPrincipalForApp();
        String BusinessNo = principal.getBusinessno();
        return BusinessNo;
    }
}
